package com.itheima.project.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.project.exception.ProjectException;
import com.itheima.project.pojo.File;
import com.itheima.project.vo.file.FileVo;
import com.itheima.project.vo.file.UploadMultipartFile;

import java.util.List;
import java.util.Set;

/**
 * @Description：附件 服务类
 */
public interface IFileService extends IService<File> {

    /**
     * @Description 附件列表
     * @param fileVo 查询条件
     * @return
     */
    Page<File> findFileVoPage(FileVo fileVo, int pageNum, int pageSize);

    /***
     * @description 下载文件
     * @param fileId
     * @return
     */
    FileVo downLoad(Long fileId) throws ProjectException;

    /**
     * @Description 文件上传
     * @param multipartFile 上传对象
     * @param fileVo 附件对象
     * @return
     */
    File upLoad(UploadMultipartFile multipartFile,
                FileVo fileVo) throws ProjectException;

    /**
     * @Description 为上传绑定对应的业务Id
     * @param  fileVo 附件对象
     * @return
     */
    File bindBusinessId(FileVo fileVo);

    /**
     * @Description 按业务ID查询附件
     * @param  businessId 附件对象业务Id
     * @return
     */
    List<File> findFileVoByBusinessId(Long businessId);

    /**
     * @Description 删除业务相关附件
     * @param businessId 业务Id
     * @return
     */
    Boolean deleteFileVoByBusinessId(Long businessId);

    /**
     * @Description 删除附件
     * @param checkedIds 对象信息Id
     * @return
     */
    Boolean deleteFile(String[] checkedIds);

    /***
     * @description 初始化所有businessId
     *
     * @return: java.util.Set<java.lang.Long>
     */
    Set<Long> findBusinessIdAll();
}
